unit unit_frmRPOpen;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, unit_frmDialogBaseForm, StdCtrls, ExtCtrls, GridsEh, DBGridEh,
  DB, DBClient, Provider, ADODB, DBCtrls, Spin, DBGridEhGrouping;

type
  TfrmRPOpen = class(TfrmDialogBaseForm)
    pnlRPList: TPanel;
    btnOK: TButton;
    btnCancel: TButton;
    cdsAllReport: TClientDataSet;
    dtsAllReport: TDataSource;
    cdsGetRPParams: TClientDataSet;
    dtsGetRPParams: TDataSource;
    GroupBox1: TGroupBox;
    grdRPList: TDBGridEh;
    pnlInfo: TPanel;
    DBMemo1: TDBMemo;
    Splitter1: TSplitter;
    grdRPParams: TDBGridEh;
    Label1: TLabel;
    edtReportSn: TSpinEdit;
    procedure FormCreate(Sender: TObject);
    procedure cdsAllReportAfterScroll(DataSet: TDataSet);
    procedure grdRPListDblClick(Sender: TObject);
    procedure edtReportSnChange(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmRPOpen: TfrmRPOpen;

implementation

uses unit_dmRPMain, unit_dmPub;

{$R *.dfm}

procedure TfrmRPOpen.FormCreate(Sender: TObject);
begin
  inherited;
  with cdsAllReport do
  begin
    Close;
    Data := dmPub.GetData(CommandText, Params);
  end;
end;

procedure TfrmRPOpen.cdsAllReportAfterScroll(DataSet: TDataSet);
begin
  inherited;
  with cdsGetRPParams do
  begin
    Close;
    Params.ParamByName('rp_sn').Value := DataSet.FieldByName('sn').Value;
    Data := dmPub.GetData(CommandText, Params);
  end;
end;

procedure TfrmRPOpen.grdRPListDblClick(Sender: TObject);
begin
  inherited;
  ModalResult := mrOk;  
end;

procedure TfrmRPOpen.edtReportSnChange(Sender: TObject);
begin
  inherited;
  with cdsAllReport do
  begin
    Filtered := False;
    Filter := 'sn >= ' + IntToStr(edtReportSn.Value);
    Filtered := True;
  end;
end;

end.
